{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import torch"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Vector:\t\t tensor([1, 2, 3, 4])\n",
      "Vector Shape:\t torch.Size([4])\n"
     ]
    }
   ],
   "source": [
    "#定义向量\n",
    "vector = torch.tensor([1,2,3,4])\n",
    "print('Vector:\\t\\t', vector)\n",
    "print('Vector Shape:\\t', vector.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Matrix:\n",
      " tensor([[1, 2],\n",
      "        [3, 4]])\n",
      "Matirx Shape:\n",
      " torch.Size([2, 2])\n"
     ]
    }
   ],
   "source": [
    "#定义矩阵\n",
    "matrix = torch.tensor([[1,2],[3,4]])\n",
    "print('Matrix:\\n', matrix)\n",
    "print('Matirx Shape:\\n', matrix.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Tensor:\n",
      " tensor([[[1, 2],\n",
      "         [3, 4]],\n",
      "\n",
      "        [[1, 2],\n",
      "         [3, 4]]])\n",
      "Tensor Shape:\n",
      " torch.Size([2, 2, 2])\n"
     ]
    }
   ],
   "source": [
    "#定义张量\n",
    "tensor = torch.tensor([[[1,2],[3,4]],[[1,2],[3,4]]])\n",
    "print('Tensor:\\n', tensor)\n",
    "print('Tensor Shape:\\n', tensor.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python p1",
   "language": "python",
   "name": "p1"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
